<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>
        <%- result.title %>
    </title>
    <%- include common %>
        <style>
            body {
                font-size: 16px;
            }

            .mv-item {
                margin-top: 20px;
                box-sizing: border-box;
                padding: 0 10px;
            }

            /* .subject {
                width: 500px;
                
            } */

            #mainpic {
                text-align: center;
                margin: 3px 12px 0 0;
                margin-right: 15px;
            }


            #info {
                width: 270px;
                margin: auto;
            }

            .pl {
                line-height: 150%;
                color: #666666;
            }
        </style>
</head>

<body>
    <%- include('head',{title:'movie',username:username })%>
        <div class="container">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-6">
                        <h2 class="text-success text-center"> 《<%-result.title %>》电影详情</h2>
                        <div class="subject clearfix">
                            <div id="mainpic" class="">
                                <a><img src="<%- result.images.large.replace(/img7/,'img3') %>" title="点击看更多海报"
                                        alt="<%- result.original_title %>"></a>
                            </div>
                            <div id="info">
                                <span><span class="pl">导演</span>: <span class="attrs"><a>
                                            <%- result.directors[0].name %>
                                        </a></span></span><br>
                                <span class="actor"><span class="pl">主演</span>: <span class="attrs">
                                      <%  result.casts.forEach((item,i)=>{  %>
                                            <span><a href="" rel="v:starring"><%- item.name %></a> / </span>
                                      <%  })    %>
                                      <br>
                                <span class="pl">类型:</span> <span property="v:genre"><%- result.genres %></span><br>
                                        <span class="pl">上映日期:</span> <span property="v:initialReleaseDate" content="<%- result.year%>">
                                            <%- result.year%>
                                        </span><br>
                                        <span class="pl">评分：</span><span><%- result.rating.average %></span>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <h2 class="text-primary text-center"> 电影评论</h2>
                        <form  action="/comment/insert?cid=<%- result.id %>"  method="POST"  >
                            <div class="form-group">
                                <label for="title">标题</label>
                                <input type="text"    name="title" class="form-control" id="title" placeholder="Title">
                            </div>
                            <div class="form-group">
                                <label for="content">内容</label>
                                <textarea class="form-control"  name="content" id="content" cols="30" rows="10" placeholder="Content"></textarea>
                            </div>
                            <button type="submit" class="btn btn-success" >提交评论</button>
                            <button type="reset" class="btn btn-danger">重置</button>
                        </form>    
                    </div>
                </div>
            </div>
        </div>
            <%- include foot %>

            <script>
                // $("#content").xheditor(); // 简单的实例化 
                $(pageInit);
                function pageInit(){
                    $.extend(XHEDITOR.settings,{shortcuts:{"ctrl+enter":submitForm}});
                    // $("#ele").xheditor();
                    $("#content").xheditor({   //初始化 富文件编辑框
                        html5Upload:false,
                        upMultiple:"1",
        
                        upLinkRrl:"upload.html",
                        upLinkExt:"zip,rar,txt",
        
                        upImgUrl:"/comment/uploadImg",   // 图片上传的服务器  
                        upImgExt:"jpg,jpeg,gif,png",
        
                        upFlashUrl:"upload.php",
                        upFlashExt:"swf",
        
                        upMediaUrl:"upload.php",
                        upMediaExt:"wmv,avi,wma,mp3,mid"
        
                    });
                };
        
                function insertUpload(arrMsg){
                    console.log(arrMsg);
                    var i,msg;
                    for(var i=0;i<arrMsg.length;i++){
                        msg=arrMsg[i];
                        console.log(msg);
                        $("#uploadList").append('<option value="'+msg.id+'">'+msg.localname+'</option>')
                    }
                };
        
                function submitForm(){
                    $("#frmDemo").submit();
                }
        
            </script>
        </body>

</html>
